home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / misc / cx85.m65 < prev    next >
Text File  |  1995-04-22  |  5KB  |  181 lines

  1. 1000     .TITLE "CX85 NUMERIC KEYPAD HANDLER - Mac65 version"
  2. 1010     .PAGE "Dissasembled by Rich Andrews, Lockport, Il."
  3. 1020 ;
  4. 1030 ;There was no copyright notice in the original
  5. 1040 ; code but one must assume it is public domain
  6. 1050 ;and was probably written by Atari Inc.
  7. 1060 ;(no one else would have bothered!)
  8. 1070 ;once called by Basic do not call again
  9. 1080 ;Call thru basic with a X=USR(32512)
  10. 1090 ;
  11. 1100     .PAGE "CX-85 EQUATES"
  12. 1110 ;******************************
  13. 1120 ;System equates used
  14. 1130 ;******************************
  15. 1140 ATRACT = $4D
  16. 1150 VVBLKD = $0224
  17. 1160 STRIG0 = $0284
  18. 1170 STRIG1 = $0285
  19. 1180 CH  =   $02FC
  20. 1190 ALLPOT = $D208
  21. 1200 PORTA = $D300
  22. 1210 SETVBV = $E45C
  23. 1220 XITVBV = $E462
  24. 1230 ;
  25. 1240 ;*****************************
  26. 1250 ;End of system equates
  27. 1260 ;*****************************
  28. 1270 ;The following is the keycode
  29. 1280 ;equates which are from CH. As
  30. 1290 ;per the Atari hardware manual.
  31. 1300 ;*****************************
  32. 1310 ;
  33. 1320 ;
  34. 1330 ESC =   $1C
  35. 1340 SPC =   $21
  36. 1350 DEL =   $34
  37. 1360 Y   =   $2B
  38. 1370 ZERO =  $32
  39. 1380 ONE =   $1F
  40. 1390 TWO =   $1E
  41. 1400 THREE = $1A
  42. 1410 FOUR =  $18
  43. 1420 FIVE =  $1D
  44. 1430 SIX =   $1B
  45. 1440 SEVEN = $33
  46. 1450 EIGHT = $35
  47. 1460 NINE =  $30
  48. 1470 PERIOD = $22
  49. 1480 MINUS = $0E
  50. 1490 CR  =   $0C
  51. 1500 ;
  52. 1510     .PAGE "CX-85 HANDLER INSTALLATION ROUTINE"
  53. 1520 ;******************************
  54. 1530 ;This is the start of the installation routine
  55. 1540 ;******************************
  56. 1550 ;
  57. 1560 ;
  58. 1570     .ORG $7F00  ;Start code just below GR.0 screen.
  59. 1580     PLA         ;This routine is to be called by basic hence the PLA
  60. 1590 ;Remove the PLA instruction for a stand alone file
  61. 1600     LDA VVBLKD  ;Call with X=USR(32512)
  62. 1610 ;The installation routine could also be a M/L string with the rest
  63. 1620 ;of the code previously loaded in via DOS.
  64. 1630     STA EXIT+1
  65. 1640     LDA VVBLKD+1
  66. 1650     STA EXIT+2
  67. 1660     LDY # <VBICODE
  68. 1670     LDX # >VBICODE
  69. 1680     LDA #$07    ;Command to reset vbi pointers.
  70. 1690     JSR SETVBV  ;Install vbi routine into interrupt chain.
  71. 1700     RTS         ;Return to caller.
  72. 1710     .PAGE "CX85 HANDLER LOOKUP TABLE"
  73. 1720 ;******************************
  74. 1730 LOOKUP ;        This is the lookup table.  This portion can be located
  75. 1740 ;in a different area in memory than the Main routine or the
  76. 1750 ;installation routine.
  77. 1760 ;******************************
  78. 1770     .BYTE $0C,ESC
  79. 1780     .BYTE $14,SPC,$10,DEL,$18,Y
  80. 1790     .BYTE $1C,ZERO,$19,ONE,$1A,TWO
  81. 1800     .BYTE $1B,THREE,$11,FOUR,$12
  82. 1810     .BYTE FIVE,$13,SIX,$15,SEVEN
  83. 1820     .BYTE $16,EIGHT,$17,NINE,$1D
  84. 1830     .BYTE PERIOD,$1F,MINUS,$1E
  85. 1840     .BYTE CR
  86. 1850     BRK         ;End of table delimiter
  87. 1860 ;*****************************
  88. 1870 ;By changing the table one could define
  89. 1880 ;the keys on the CX85 to mean anything!
  90. 1890 ;How about some new functions to be accessed
  91. 1900 ;through a wedge of some sort?  Terminal
  92. 1910 ;program phone dialer?  Maybe a bookkeeping
  93. 1920 ;program? As long as it is a printable
  94. 1930 ;character it will work. Rich A.
  95. 1940     .PAGE "CX-85 HANDLER MAIN VBI ROUTINE"
  96. 1950 ;*****************************
  97. 1960 ;The vbi routine starts here.
  98. 1970 ;*****************************
  99. 1980 ;This portion can be located anywhere in memory.
  100. 1990 ;*****************************
  101. 2000 VBICODE
  102. 2010     LDA STRIG1  ;trigger pressed?
  103. 2020     BNE SET2BYE ;no-go clr buffer #2+exit.
  104. 2030     LDA #$00
  105. 2040     STA ATRACT  ;kill attract mode
  106. 2050     LDA PORTA   ;lets get some bits
  107. 2060     LSR A       ;divide by 2
  108. 2070     LSR A       ;divide it again
  109. 2080     LSR A       ;ditto
  110. 2090     LSR A       ;one more time (Sam?)
  111. 2100     STA BUFR1   ;now stuff it in buffer 1
  112. 2110     LDA ALLPOT  ;read all the pot lines
  113. 2120     AND #$08    ;if it is >=8,then make it 0
  114. 2130     EOR #$08    ;if it is <8 then make it 8
  115. 2140     ASL A       ;times 2
  116. 2150     ORA BUFR1
  117. 2160     LDY #$00
  118. 2170 ;*******************************
  119. 2180 FINDIT
  120. 2190     CMP LOOKUP,Y
  121. 2200     BEQ FOUND   ;found the code
  122. 2210     INY 
  123. 2220     INY 
  124. 2230     LDX LOOKUP,Y
  125. 2240     BEQ EXIT
  126. 2250     BNE FINDIT
  127. 2260 ;******************************
  128. 2270 FOUND
  129. 2280     TAX 
  130. 2290     INY 
  131. 2300     LDA LOOKUP,Y
  132. 2310     CMP BUFR2
  133. 2320     BEQ PUTCHR
  134. 2330     STA BUFR2
  135. 2340     STA CH
  136. 2350     LDA #$30
  137. 2360     STA BUFR3
  138. 2370     BNE EXIT    ;always exit
  139. 2380 ;******************************
  140. 2390 SET2BYE
  141. 2400     LDA #$C0    ;when trig1 is not pressed
  142. 2410     STA BUFR2   ;read will come back with $C0
  143. 2420     BNE EXIT    ;always exit
  144. 2430 ;******************************
  145. 2440 PUTCHR
  146. 2450     LDX BUFR3
  147. 2460     DEX 
  148. 2470     BNE SET3BYE
  149. 2480     STA CH
  150. 2490     LDA #$06
  151. 2500     STA BUFR3
  152. 2510     BNE EXIT
  153. 2520 ;*********************
  154. 2530 SET3BYE
  155. 2540     STX BUFR3
  156. 2550 ;*********************
  157. 2560 EXIT
  158. 2570     JMP XITVBV  ;see you next vbi
  159. 2580 ;*********************
  160. 2590 BUFR1
  161. 2600     .DS 1       ;reserve 1 byte
  162. 2610 ;*********************
  163. 2620 BUFR2
  164. 2630     .DS 1       ;reserve 1 byte
  165. 2640 ;*********************
  166. 2650 BUFR3
  167. 2660     .DS 1       ;reserve 1 byte
  168. 2670 ;*********************
  169. 2680     .END 
  170. 2690 ;The original key layout is as
  171. 2700 ;follows
  172. 2710 ;-----------------------
  173. 2720 ; esc                  |
  174. 2730 ;       7 8 9    -     |
  175. 2740 ;  N    4 5 6    r     |
  176. 2750 ;<del>  1 2 3    e     |
  177. 2760 ;  Y     0  .    t     |
  178. 2770 ;                      |
  179. 2780 ;-----------------------
  180. 2790 ; <eof>
  181.